package vue;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridLayout;

import javax.swing.BorderFactory;
import javax.swing.JPanel;

public class PanelJeu extends JPanel {

	private Pion[][] pions;
	private static boolean flagFinish = false;
	
	public PanelJeu()
	{
		this.setPreferredSize(new Dimension(320,510));
		pions = new Pion[6][4];
		
		this.setLayout(new GridLayout(6,4));
				
		for (int i = 0; i<6; i++)
		{
			for (int j = 0; j<4; j++)
			{
				pions[i][j] = new Pion();
				pions[i][j].setBorder(BorderFactory.createLineBorder (Color.black, 1));
				this.add(pions[i][j]);
				
			}
		}
	}
	
	public void setPions(int ligne, Pion[] p)
	{
		if (ligne != -1 && !flagFinish)
		{
			for (int i=0; i < 4; i++)
			{
				pions[ligne][i].setColor(p[i].getColor());
			}
		}
		if (ligne == 0)
		{
			flagFinish = true;
		}
	}
}
